package easy

import "workspace/node"

func GetTargetCopy(original, cloned, target *node.TreeNode) *node.TreeNode {
	if original == nil {
		return nil
	}
	if original.Val == target.Val {
		return cloned
	}
	left := GetTargetCopy(original.Left, cloned.Left, target)
	if left != nil {
		return left
	}
	return GetTargetCopy(original.Right, cloned.Right, target)
}
